//
//  HWMineHotGameItemView.swift
//  HWanGame
//
//  Created by 王昌健 on 2021/12/22.
//  Copyright © 2021 94Wan. All rights reserved.
//

import UIKit

class HWMineHotGameItemView: UIView {

    var imageView:UIImageView!
    var nameLabel:UILabel!
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        initUI()
        
        initFrame()
        
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        
    }
}

extension HWMineHotGameItemView {
    private func initUI() -> Void {
        imageView = UIImageView()
        imageView.layer.cornerRadius = 10*widthScale
        imageView.layer.masksToBounds = true
        addSubview(imageView)
        
        nameLabel = HWLabel.createLabel(title: "", color: "#888888", font: 10*widthScale)
        nameLabel.numberOfLines = 1
        nameLabel.textAlignment = .center
        addSubview(nameLabel)
    }
    
    private func initFrame() -> Void {
        imageView.snp.makeConstraints { make in
            make.width.height.equalTo(52*widthScale)
            make.centerX.equalToSuperview()
            make.top.equalTo(3*widthScale)
        }
        
        nameLabel.snp.makeConstraints { make in
            make.centerX.equalToSuperview()
            make.left.equalTo(5*widthScale)
            make.right.equalTo(-5*widthScale)
            make.top.equalTo(imageView.snp.bottom).offset(5*widthScale)
        }
    }
}
